// 测点信息
<template>
  <div class="container">
    <el-tabs
      v-model="stationActiveName"
      tab-position="right"
      @tab-click="handleClick"
    >
      <el-tab-pane name="parkingLot" label="车位温度">
        <parkingLot v-if="parkingLot" />
      </el-tab-pane>
      <el-tab-pane name="other" label="其它测点">
        <other v-if="other" />
      </el-tab-pane>
      <el-tab-pane name="naturalGas" label="天然气流量">
        <naturalGas v-if="naturalGas" />
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import parkingLot from './parkingLot'
import naturalGas from './naturalGas'
import other from './other'
export default {
  name: '',
  components: {
    parkingLot,
    naturalGas,
    other
  },
  props: {},
  data () {
    return {
      stationActiveName: 'parkingLot',
      parkingLot: true,
      naturalGas: false,
      other: false
    }
  },
  computed: {},
  watch: {},
  created () {
    this.kind = 'stationInfo'
    if (sessionStorage.getItem('kilnActiveName')) {
      if (
        sessionStorage.getItem('kilnActiveName') !== 'naturalGas' &&
        sessionStorage.getItem('kilnActiveName') !== 'other' &&
        sessionStorage.getItem('kilnActiveName') !== 'parkingLot'
      ) {
        this.stationActiveName = 'parkingLot'
        this.parkingLot = true
        this.other = false
        this.naturalGas = false
      } else {
        this.stationActiveName = sessionStorage.getItem('kilnActiveName')
        switch (sessionStorage.getItem('kilnActiveName')) {
          case 'parkingLot':
            this.parkingLot = true
            this.other = false
            this.naturalGas = false
            break
          case 'other':
            this.parkingLot = false
            this.other = true
            this.naturalGas = false
            break
          case 'naturalGas':
            this.parkingLot = false
            this.other = false
            this.naturalGas = true
            break
          default:
            console.log('出错了')
            break
        }
      }
    }
  },
  mounted () {},
  methods: {
    handleClick (tab, event) {
      switch (tab.index) {
        case '0':
          this.parkingLot = true
          this.other = false
          this.naturalGas = false
          break
        case '1':
          this.parkingLot = false
          this.other = true
          this.naturalGas = false
          break
        case '2':
          this.parkingLot = false
          this.other = false
          this.naturalGas = true
          break
        default:
          console.log('出错了')
          break
      }
    }
  }
}
</script>

<style scoped lang="">
</style>
